#ifndef FND_GAME_D3D_TEXTURE_MANAGER_H
#define FND_GAME_D3D_TEXTURE_MANAGER_H
#include <map>
#include <boost/noncopyable.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/any.hpp>

enum texture_info_type_enum {
    TITE_TEXTURE,
    TITE_FILENAME,
    TITE_TYPE,
} ;
class d3d_texture_manager : boost::noncopyable {
public:
    //d3d_texture_manager() ;
    ~d3d_texture_manager() ;
    bool add_texture(const std::string& name,
                     const std::string& file_name,
                     int type);
    void recreate_textures() ;
    template<typename T>
    T get_texture(const std::string& name) {
        return boost::any_cast<T>(boost::get<TITE_TEXTURE>(m_textures[name])) ;
    }
    void recreate_texture(const std::string& name) ;
    void remove_texture(const std::string& name) ;
    bool has_texture(const std::string& name) const ;
    void load_textures_from_page(const std::string& page_name) ;
private:
    typedef boost::tuple<boost::any, std::string, int> texture_info_type ;
    typedef std::map<std::string, texture_info_type> texture_group_type ;
    texture_group_type m_textures ;
    void add_a_texture_from_page(const std::string&,
                                 const std::string&) ;

    void release_all_textures() ;
    
} ;

#endif
